#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N=2e5;
const int maxn=1e6;
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//

void solve() {
	int n;
	sd(n);
	string s;
	cin >> s;
	int flag = 0;
	int oo = 0;
	int pp = 0;
	for (int i = 0; i < s.length(); i++) 
	{
		if (s[i] == 'B') 
		{
			oo = 1;
		}
		else if (s[i] == 'R') 
		{
			pp = 1;
		}
		else if (s[i] == 'W') 
		{
			if ((oo == 1 && pp == 0)) 
			{
				flag = 1;
				break;
			}
			if ((pp == 1 && oo == 0)) 
			{
				flag = 1;
				break;
			}
			oo = 0;
			pp = 0;
		}

	}
	if ((oo == 1 && pp == 0) || (pp == 1 && oo == 0)) flag = 1;
	if (flag == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
}

int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}